package com.makefuture.echarts;

import java.util.List;

import com.github.abel533.echarts.code.Tool;
import com.github.abel533.echarts.data.Data;
import com.github.abel533.echarts.series.Gauge;
import com.github.abel533.echarts.series.gauge.Detail;
import com.jfinal.core.Controller;
import com.makefuture.util.EnhancedOption;
import com.makefuture.util.ReadTemplateUtil;
import com.makefuture.util.WriteToExploer;

/**
 * 仪表盘
 * @author Adminstrator
 *
 */
public class GaugeController extends Controller {

	 public void index() {
	        // 地址： http://echarts.baidu.com/doc/example/gauge1.html
	        EnhancedOption option = new EnhancedOption();
	        option.tooltip().formatter("{a} <br/>{b} : {c}%");
	        option.toolbox().show(true).feature(Tool.mark, Tool.restore, Tool.saveAsImage);
	        option.series(new Gauge("业务指标").detail(new Detail().formatter("{value}%")).data(new Data("完成率", 75)));
	        
	        List<String> lines = ReadTemplateUtil.readLines(option);
	        WriteToExploer.write(getResponse(), lines);
	        renderNull();
	    }
}
